Skip to content

Conversation

@arukiidou
Copy link

@arukiidou arukiidou commented Oct 31, 2025

Migrate ExtensionContext.Store.CloseableResource to AutoCloseable

background

ExtensionContext.Store.CloseableResource is deprecated since 5.13

see:
https://docs.junit.org/5.14.0/user-guide/#extensions-keeping-state

Resource management via AutoCloseable
An extension context store is bound to its extension context lifecycle. When an extension context lifecycle ends it closes its associated store. As of JUnit 5.13, all stored values that are instances of AutoCloseable are notified by an invocation of their close() method in the inverse order they were added in (unless the junit.jupiter.extensions.store.close.autocloseable.enabled configuration parameter is set to false). Older versions only supported CloseableResource, which is deprecated but still available for backward compatibility.

https://docs.junit.org/5.14.0/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.Store.CloseableResource.html

Deprecated.
Please extend AutoCloseable directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Replace ExtensionContext.Store.CloseableResource to AutoCloseable

1 participant